import request from "@/netword/request";


const fun = {};


// 分页查询所有信息
fun.getList = async (param) => {
    const res = await request({
        url: "/a/core/param/list",
        method: "post",
        params: {
            paramName: param.paramName,
            paramKey: param.paramKey,
            paramValue: param.paramValue,
            isSystem: param.isSystem,
            pageNo: param.pageNo,
            pageSize: param.pageSize,
            status: param.status
        }
    })
    return res.data;
}



//保存数据
fun.saveParam = async (param) => {
    const res = await request({
        url: "/a/core/param/save",
        method: "put",
        params: {
            paramName: param.paramName,
            paramKey: param.paramKey,
            paramValue: param.paramValue,
            paramDetail:param.paramDetail,
            isSystem: param.isSystem,
            sort: param.sort,
            remarks: param.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateParam = async (param) => {
    const res = await request({
        url: "/a/core/param/update",
        method: "post",
        params: {
            id: param.id,
            paramName: param.paramName,
            paramKey: param.paramKey,
            paramValue: param.paramValue,
            paramDetail:param.paramDetail,
            isSystem: param.isSystem,
            sort: param.sort,
            remarks: param.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/core/param/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getParam = async (id) => {
    const res = await request({
        url: "/a/core/param/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}



//查询单条数据
fun.getByKey = async (paramKey) => {
    const res = await request({
        url: "/a/core/param/getByKey",
        method: "get",
        params: {
            paramKey: paramKey
        }
    })
    return res.data;
}


export default fun;